package com.derschmale.wick3d.display3D
{
	import com.derschmale.wick3d.core.io.collada.DAEParser;
	import com.derschmale.wick3d.core.objects.HierarchicObject3D;
	
	import flash.events.Event;
	
	public class Collada extends HierarchicObject3D
	{
		private var _parser : DAEParser;
		
		public function Collada(filename : String)
		{
			_parser = new DAEParser(filename);
			_parser.addEventListener(Event.COMPLETE, handleLoadComplete);
		}
		
		private function handleLoadComplete(event : Event) : void
		{
			var models : Array = _parser.models;
		
			for (var i : int = 0; i < models.length; i++) {
				addChild(models[i]);
			}
			dispatchEvent(new Event(Event.COMPLETE));
		}
	}
}